package com.vue.enums;

import lombok.Getter;

/**
 * @Author wzd
 * @Version 1.0
 * @Description :<登录企业type>
 * @Date 2022/8/11 17:01
 **/
@Getter
public enum LoginTypeEnum {



    PC(1,"pc"),
    APP(2,"APP"),
    PT(3,"PT");
    private Integer key;
    private String value;

    LoginTypeEnum(Integer key, String value){
        this.key=key;
        this.value=value;
    }
    /**
     * 自己定义一个静态方法,通过key返回枚举常量对象
     * @param key
     * @return
     */
    public static LoginTypeEnum getByKey(Integer key){

        for (LoginTypeEnum color: values()) {
            if(color.getKey().equals(key)){
                return  color;
            }
        }
        return null;
    }

    /**
     * 自己定义一个静态方法,通过value返回枚举常量对象
     * @param value
     * @return
     */
    public static LoginTypeEnum getByValue(String value){

        for (LoginTypeEnum color: values()) {
            if(color.getValue().equals(value)){
                return color;
            }
        }
        return null;
    }
}
